<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@ include file="../tld/tlds.jsp"%>
<html>
	<head>
		<style>
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

a.page:link {
	color: #000000;
	text-decoration: none;
}

a.page:hover {
	color: #FF00FF;
	text-decoration: none;
}

a.page:active {
	color: #FF00FF;
	text-decoration: none;
}

a.page:active {
	color: #FF00FF;
	text-decoration: none;
}

.STYLE2 {
	color: #666666
}

body {
	margin: 0px;
	font: normal 12px "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	SCROLLBAR-FACE-COLOR: rgb(31, 111, 191);
	SCROLLBAR-HIGHLIGHT-COLOR: rgb(31, 111, 191);
	SCROLLBAR-SHADOW-COLOR: rgb(10, 0, 209);
	SCROLLBAR-3DLIGHT-COLOR: rgb(23, 121, 255);
	SCROLLBAR-ARROW-COLOR: rgb(2, 51, 138);
	SCROLLBAR-TRACK-COLOR: rgb(46, 131, 215);
	SCROLLBAR-BASE-COLOR: rgb(46, 131, 215);
}
</style>
		<link href="css/css.css" rel="stylesheet" type="text/css" />
		<script language="JavaScript" src="js/meihuaxue.js"></script>
		<script language="javaScript" src="js/prototype.js"></script>
		<script type="text/javascript" src="js/submit.js"></script>
		<script type="text/javascript">
		    function isDigit(s) 
			   { 
			     var currPage = document.getElementById("currPage").value;
			     var patrn=/^[0-9]{1,20}$/; 
			      if (!patrn.exec(currPage)){
				    alert("请输入数字");
			        return false ;
					}else{
		            location="managerLink.jsp?currPage="+currPage;
		          }
		     }
		</script>
	</head>
	<body bgcolor="#4194E7" leftmargin="0" topmargin="0" marginheight="0"
		marginwidth="0">
		<%
		    int typeid = 0;
		    int bigid = 0;
		    int smallid = 0;
		    String hql = "";
		    MessageDAO messageDao = new MessageDAO();
		    Message message = new Message();
		    //当前页面
			int currPage = 1;
			//总的页数
			int totalPage = 1;
			//一个页面可显示的记录数
			int pageSize = 20;
			//总共有的记录数
			int totalCount = 1;
			List  li = new ArrayList();
			//li = messageDao.findAll();
			//得到总的记录数
			totalCount = messageDao.getTotalCount(Message.class);//li.size();
			//得到总的页数
			if(totalCount > pageSize){
			   totalPage = totalCount/pageSize+1;
			   }else{
			   totalPage = 1;
			   }
			//判断是否是传过来页数
			if(request.getParameter("currPage") != null){
			   currPage = Integer.parseInt(request.getParameter("currPage"));
			   if(currPage<1){
			     currPage=1;
			    }
			   if(currPage >totalPage){
			     currPage = totalPage;
			   }
			} 
			//得到记录数
			
			  List li2 = messageDao.findPageByHql(hql,currPage,pageSize);
		 %>
		<form name="form1" id="form1"
			action="/admin/managerNewLei.do?method=managerLei" method="post"
			onsubmit="return isDigit()" />
			
			<table cellspacing="0" cellpadding="0" align="center" width="100%"
				cellspacing="20">
				<tr>
					<td bgcolor="#0650D2" align="center" height="25" class="lm_title">
						短 信 平 台 管 理
					</td>
				</tr>
				
				<Tr>
					<td align="left">
						<table cellpadding="1" cellspacing="0" align="center" width="100%"
							class="main_table">
							<tr>
								<td valign="top">
									<table cellspacing="0" align="right" width="100%"
										class="main_table">
										<tr width="100%">
											<td width="3%" align="center"></td>
											<td width="35%" align="center">
												短信标题
											</td>
											<td width="35%" align="center">
												添加时间
											</td>
											<td width="10%" align="center">
												是否回复
											</td>
											<td width="15%" align="center">
												操作
											</td>
										</tr>
										<%
										   System.out.print(li2.size());
										   for(int i = 0 ; i < li2.size(); i++){
										      message = (Message)li2.get(i);
										      
										 %>
										<tr>
											<td>
												<input type="checkbox" name="MyCheckBox" id="MyCheckBox"
													value="<%=message.getId() %>" />
											</td>
											<td align="center">
												<%=message.getTitle()%>
											</td>
											<td align="center">
												<%=message.getAddDate().toLocaleString()%>
											</td>
											<td align="center">
												<%
										          if(message.getIfRe().equals("0")){
										            out.print("否");
										          }else{
										             out.print("是");
										          }
										        %>
											</td>
											<td align="center">
											    <a href="messageInfo.jsp?id=<%=message.getId()%>">查看</a>&nbsp;
												<a href="/admin/infoMessage.do?method=delMessage&id=<%=message.getId() %>">删除</a>
											</td>
										</tr>
										<%
										  }
										 %>
										<tr>
										   <td colspan="5" align="left">
										      <input type="button" name="selectAlls" id="selectAlls" value="全选" onclick="return selectAll()" />
										      <input type="button" name="noSelectAll" id="noSelectAll" value="反选" onclick="return selectOthers();" />
										       <input type="button" name="cancelSelects" id="cancelSelects" value="取消选择" onclick="return cancelSelect();" />
										      <input type="button" name="delAlls" id="delAlls" value="全部删除" onclick="return delAllMessage();"/>
										   </td>
										</tr>
										<tr>
											<td  align="center" height="25"
												class="lm_title" colspan="5">
												共有［<%=totalPage %>］页 当前是第［<%=currPage %>］页 [
												<a href="messageList.jsp?currPage=1" class="page">首页</a>][
												<a href="messageList.jsp?currPage=<%=currPage-1 %>"
													class="page">上一页</a>][
												<a href="messageList.jsp?currPage=<%=currPage+1 %>"
													class="page">下一页</a>][
												<a href="messageList.jsp?currPage=<%=totalPage %>"
													class="page">尾页</a>]
												<input type="button" value="GO" onclick="isDigit()" />
												<input type="text" size="1" id="currPage" name="currPage" />
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</Tr>

				<tr>
					<td height="10"></td>
				</tr>
				<Tr>
					<td bgcolor="#0650D2" align="center" height="25" class="lm_title">
						Copyright 2008-2009 &copy; 登封市财政局 All Rights Reserved.
					</td>
				</Tr>

			</table>
		</form>
	</body>
</html>
<script type="text/javascript">
<!--
var message = "<%=session.getAttribute("message")%>";
if(message!=null && message!="null" && message !=""){
   alert(message);
  }
//-->
</script>
<%
	session.removeAttribute("message");
%>

